// @ts-ignore
import store from 'store'

const Maven = {
  USER_KEY: 'userKey',
  TOEKEN: 'token'
}

export default {
/*
保存user
*/
  saveUser (user) {
  // localStorage.setItem(Maven.USER_KEY,JSON.stringify(user));
    store.set(Maven.USER_KEY, user);
  },
  /*
* 读取user
*/
  getUser () {
    // return JSON.parse(localStorage.getItem(Maven.USER_KEY) || '{}');
    return store.get(Maven.USER_KEY) || {};
  },

  /*
* 删除 user
* */
  removeUser () {
    // localStorage.removeItem(Maven.USER_KEY)
    store.remove(Maven.USER_KEY)
  },
  /*
* 保存TOEKN
* */
  saveToken (token) {
    // localStorage.setItem(Maven.TOEKEN,token);
    store.set(Maven.TOEKEN, token);
  },
  /*
* 读取user
*/
  getToken () {
    // return localStorage.getItem(Maven.TOEKEN);
    return store.get(Maven.TOEKEN) || '';
  },

  /*
* 删除 user
* */
  removeToken () {
    // localStorage.removeItem(Maven.TOEKEN)
    store.remove(Maven.TOEKEN)
  }
}
